<%@ page language="java" contentType="text/html; charset=utf-8"%>
    
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<style type="text/css">
     body{font-size: 12px;}
    .input{font-size: 12px; color:red;} 
    .intext{font-size: 12px; color:blue;}
     input{font-size: 12px;} 
    .party_tbl_new {
      border-top:1px solid #bbbbbb;
    }
	.party_tbl_new tr td {
	 font-family: "굴림";
	 font-size: 12px;
	 color: #666666;
	 text-align: center;
	 border-bottom:1px solid #bbbbbb; border-left:1px solid #bbbbbb;
	}
	.border_last{
	 border-right:1px solid #bbbbbb; 
	}
</style>
<script src="jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">
  //[1] ajax를 사용하기 위한 기본 설정값  
  $(document).ready(function(){ // 페이지가 로드되었을때
	   DataLoad();
	  $('#isbnDBSave').click(isbnSave);
	  $('#alldelete').click(alldeletedata);	  
	  $('#excelSave').click(excelSave);
	  $('#sheetList').ajaxForm(
			  {
				  dataType:"json",
				  success: handleHtml
			  });  
	  $('#multiForm').ajaxForm(
			  {   // loginFail
				     success: function(data){
				     if(data=="no"){
					  alert("업로드성공");
					  $('#title').val('');
					  $('#name').val('');
					  $('#upFile').val('');
					  DataLoad();
				     }else if(data=="yes"){
				      alert("중복된파일이 있습니다\n 파일명을 변경해주세요");	  
					 }else if(data=="fail"){
				 	  alert("아이디,패스워드,파일명을입력해주세요");	  	 
					 }else if(data=="loginFail"){
				 	  alert("인증에 실패했습니다.");	  	 
					 }
				  }
			  });  
  });
  function alldeletedata(){
	  tablename=$('#tablename option:selected').text();
	  if(confirm("["+tablename+"]"+' 파일 및 데이터베이스의 모든자료는 삭제됩니다.\n 삭제하시겠습니까?')){
		  var getVal="tablename="+tablename;
		  $.ajax({
			    type:"get",
		    	url:"alldelete.spr",
		    	data: getVal,
		    	success: function(data){
		    		alert("삭제완료완료");
		    		DataLoad();
		    	} ,
		    	error: ajaxFailed
		  });  
		  
	  }else{
		  alert('취소되었습니다.');
	  }
  }  
  function DataLoad(){
	  $('#deldisplay').css("visibility", "hidden");	
	  $('#sheetdisplay').css("visibility", "hidden");
	  $('#ctlMemoList').css("visibility", "hidden");
	  $('#panel').css("visibility", "hidden");
	  
	  $.ajax({
		    type:"get",
		    dataType:"json",
	    	url:"fileList.spr",
	    	success: seletList ,
	    	error: ajaxFailed
	  });	
  } 
 function seletList(data){
   	$('#fileList').empty();
     var select="<select width='200px' name='tableName' id='tablename' onchange='goList1()'>";
	  $.each(data, function(index, entry){ 
		  if(entry['fname']!=-1){
		      var fname=entry['fname']; 		  
		      select+="<option value='"+fname+"'>"; 
		      select+=entry['fname'];
		      select+="</option>";		  
		  }else{
			  select+="<option value='NODATA' selected>검수할 파일이없습니다.</option>";  
		  }
	  });
	  select+="</select>";
	  $('#fileList').append(select);
	  
	   var deldisplay=$('#tablename option:selected').text();
	   //alert(deldisplay);
	   if(deldisplay!="검수할 파일이없습니다."){
	   	 $('#deldisplay').css("visibility", "visible");	
	   	 $('#sheetdisplay').css("visibility", "visible");	
	   }
 }   
 
  function isbnSave(){
	  tablename=$('#tablename option:selected').text();
	  //alert(tablename);	  
	  var count=$('#isbnDBSave').val();
	  var pos1=count.indexOf("(");
	  var pos2=count.indexOf(")");
	  count=count.substring(pos1+1,pos2);
	  
	  var snum=$('#sheetName').text();
	  var pos1=snum.indexOf("(");
	  var pos2=snum.indexOf(")");
	  snum=snum.substring(pos1+1,pos2);
	  var getValCmp="snum="+snum;
	  var getVal="snum="+snum;
	  var data1="";
	  for(var i=1;i<=count;i++){
	     var isbn=$('#b_isbn'+i).val();
	     if(isbn=="" || isbn.length!=13 || isbn=="undefined" || isbn=="X" || isbn=="h"){
	    	 $('#b_display'+i).empty();
	    	 continue;
	     }
	       	 $('#bisbn'+i).val(isbn);
	       	 $('#bnum'+i).val(i);
	       	 $('#snum').val(snum);
	         data1+="&b_num="+i+"&b_isbn="+isbn;	    
	  }
	  getVal=getVal+data1;
	  if(getVal!=getValCmp){
		  getVal=getVal+data1+"&tablename="+(tablename+snum);
		  // getVal="snum="+snum;
		  $('#ttt').val(tablename+snum);
		  // &tablename="+(tablename+snum);
		  //alert(getVal);
		var postVal = $("#frm").serialize();
		//alert(postVal);
	    $.ajax({
		    type:"post",
	    	url:"isbnsave.spr",
	    	data: postVal,
	    	success: function(data){
	    		if(data=="yes"){
	    			alert("DB저장완료");	    			
	    			for(var i=1;i<=count;i++){
	    				var table='';
	    				table="<input type='hidden' id='bnum"+i+"'name='b_num' value=''/>";
		    			table+="<input type='hidden' id='bisbn"+i+"'name='b_isbn' value=''/>";
	    				$('#b_display'+i).html(table);
	    			}
	    		}
	    	} ,
	    	error: ajaxFailed
	    });   
	  }else{
		  alert('데이터가 하나도 선택이 되지않았습니다.');
	  } 
  }
  function excelSave(){
   /* var count=$('#isbnDBSave').val();
	  var pos1=count.indexOf("(");
	  var pos2=count.indexOf(")");
	  count=count.substring(pos1+1,pos2);
	   */
  if(confirm('해당 SHEET를 EXCEL 파일로 생성합니다. \n 생성하시겠습니까?')){
	  tablename=$('#tablename option:selected').text(); 
	  //alert(tablename);
	  var snum=$('#sheetName').text();
	  var pos1=snum.indexOf("(");
	  var sname=snum.substring(0,pos1);
	  var pos2=snum.indexOf(")");
	  snum=snum.substring(pos1+1,pos2);
	  // 시트번호,시트이름,데이블명
	  var getVal="snum="+snum+"&sname="+sname+"&tablename="+tablename;
	  
   /* var data1="";
	  for(var i=1;i<=count;i++){
	     var isbn=$('#b_isbn'+i).val();
	     if(isbn=="" || isbn.length!=13) continue;
	       	 data1+="&b_num="+i+"&b_isbn="+isbn;	    
	  }
	  getVal=getVal+data1; */
	  //alert(getVal);
	   $.ajax({
		    type:"get",
	    	url:"excelsave.spr",
	    	data: getVal,
	    	dataType: "application/octet-stream",
	    	success: function(data){
	    		alert("EXCEL저장완료");	
	    	} ,
	    	error: ajaxFailed
	  });  
  }else{
	 alert("취소되었습니다."); 
  }   
  }
  function handleHtml(data){
	  /* alert(data);
	  $('#ctlMemoList').empty();
	  var table="<table border='0' width='350px' align='center' celpadding='0' cellspacing='0'><tr><td>번호</td><td>이름</td><td>리스트보기</td></tr>";
	  $.each(data, function(index, entry){ 
		  table+="<tr>";
		  table+="<td>"+entry["snum"]+"</td>";
		  table+="<td>"+entry["sname"]+"</td>";
		  table+="<td><a href=\"javascript:goList("+entry['snum']+",'"+entry['sname']+"','"+entry['filename']+"')\">[LIST보기]<a></td>";
		  table+="</tr>";	
	  });
	  table+="</table>";
	  $('#ctlMemoList').append(table); */
	  $('#ctlMemoList').css("visibility", "visible");
	  $('#ctlMemoList').empty();
	  var table="<table border='0' align='center' celpadding='0' cellspacing='0'><tr>";
	  $.each(data, function(index, entry){ 
		  if(entry['snum']!=-1){
		  table+="<td>";
		  //table+="<a href=\"javascript:goList("+entry['snum']+",'"+entry['sname']+"','"+entry['filename']+"')\"><button>${dto.sname}(${dto.snum})</button><a>";
		  table+="<input type='button' onClick=\"javascript:goList("+entry['snum']+",'"+entry['sname']+"','"+entry['tablename']+"')\" value='"+entry['sname']+"'/>";
		  table+="</td>";
		  }else{
			  table+="<td>데이터가없습니다.</td>";  
		  }
	  });
	  table+="</tr></table>";
	  $('#ctlMemoList').append(table);
  }
  function ajaxFailed(xmlRequest){
	 	 alert(xmlRequest.status+"\n\r"+xmlRequest.statusText+"\n\r" +xmlRequest.responseText);
	  }
  
  function goList(snum, sname, tablename){
	  //alert(tablename);
/* 	  var snum=$('#sheetName').text();
	  var pos1=snum.indexOf("(");
	  var sname=snum.substring(0,pos1);
	  var pos2=snum.indexOf(")");
	  snum=snum.substring(pos1+1,pos2); */
	  $('#panel').css("visibility", "visible");
	  $('#sheetName').text(sname+"("+snum+")SHEET:ISBN검수대상리스트");

	  var getVal="tablename="+tablename;
	  $.ajax({
		    type:"get",
		    dataType:"json",
	    	url:"excelList.spr",
	    	data: getVal,
	    	success: excelList ,
	    	error: ajaxFailed
	  });
   } 
  function goList1(){
	  tablename=$('#tablename option:selected').text();
	  //alert(tablename);
	   var getVal="tableName="+tablename;
	  $.ajax({
		    type:"get",
		    dataType:"json",
	    	url:"sheetList.spr",
	    	data: getVal,
	    	success: handleHtml ,
	    	error: ajaxFailed
	  });
   } 
  function excelList(data){
	  //alert(data.length);
	  $('#ctlExcelList').empty();
	  var snum=$('#sheetName').text();
      var pos=snum.indexOf(":");
      snum=snum.substring(0,pos);
	  $('#excelSave').val(snum+" EXCEL SAVE");
	  
	  $('#isbnDBSave').val("추출된ISBN("+data.length+")개 DB저장");
	  var table="<form id='frm' modelAttribute='isbnSaveDto' method='post'>";
	  table+="<input type='hidden' id='snum' name='snum' value='"+snum+"''>";
	  table+="<input type='hidden' id='ttt' name='tablename' value=''>";
	  table+="<table class='party_tbl_new' cellpadding='0' cellspacing='0' width='1000'>";
	  table+="<tr height='30px' bgcolor='aqua'>";
	  table+="<td width='30px' class='border_empty'>번호</td>";
	  table+="<td width='310px'>서명</td>";
	  table+="<td width='135px'>저자</td>";
	  table+="<td width='135px'>발행자</td>";
	  table+="<td width='30px'>책수</td>";
	  table+="<td width='52px'>구입가격</td>";
	  table+="<td width='130px'>ISBN</td>";
	  table+="<td width='85px'>개별</td>";
	  table+="</tr>";
	  $.each(data, function(index, entry){ 
		  var b_num=entry["b_num"];
		  var b_juje=entry["b_juje"];
		  var b_jemok=entry["b_jemok"]; 
		  if(b_jemok=="undefined"){
			  b_jemok="";
		  }
		  var b_name=entry["b_name"];
		  if(b_name=="undefined"){
			  b_name="";
		  }
		  var b_company=entry["b_company"];
		  if(b_company=="undefined"){
			  b_company="";
		  }
		  var b_year=entry["b_year"];
		  var b_su=entry["b_su"];
		  var b_price=entry["b_price"];
		  var b_isbn=entry["b_isbn"];
		  if(b_isbn=="undefined"){
			  b_isbn="";
		  }
		  table+="<div id='b_display"+b_num+"' style='visibility: visible;'>";
		  table+="<input type='hidden' id='bnum"+b_num+"'name='b_num' value=''/>";
		  table+="<input type='hidden' id='bisbn"+b_num+"'name='b_isbn' value=''/>";
		  table+="</div>";
		  table+="<tr>";
		  table+="<td>"+b_num+"</td>";
		  //table+="<td>"+b_juje+"</td>";
		  table+="<td><input type='text' id='b_jemok"+b_num+"' value='"+b_jemok+"' size='53'/>";
			  table+="<input class='input' type='button' value='U' onclick=\"jemoku('"+b_num+"')\"/></td>";
		  table+="<td><input type='text' id='b_name"+b_num+"' value='"+b_name+"' size='14'/>";
			  table+="<input class='input' type='button' value='U' onclick=\"bname('"+b_num+"')\"/></td>";
		  table+="<td><input type='text' id='b_company"+b_num+"' value='"+b_company+"'size='14'/>";
		      table+="<input class='input' type='button' value='U' onclick=\"company('"+b_num+"')\"/></td>";
		  //table+="<td>"+b_year+"</td>";
		  table+="<td>"+b_su+"</td>";
		  table+="<td>"+b_price+"</td>";
		  table+="<td align='center'><input type='text' class='intext' style='text-align: center;' id='b_isbn"+b_num+"' value='"+b_isbn+"'size='14'/>";
		  table+="<input class='input' type='button' value='U' onclick=\"isbn('"+b_num+"')\"/></td>";
		  table+="<td width='100'>";
		  table+="<input type='button' id='click"+b_num+"' onclick=\"goIsbn('"+b_num+"')\" value='개별'/>";
		    //<c:if test="${vo.b_num % 10==0 || vo.b_num==cnt}">
		    if(b_num%10==0 || b_num==data.length){
		     table+="<input type='button' onclick=\"goBatchIsbn('"+b_num+"')\" value='일괄' class='input'/>";
		    }
		    //</c:if>
		  table+="</td>";
		  table+="</tr>";
	  });
	  table+="</table></form>";
	  $('#ctlExcelList').append(table);
  }
  ///////////////////////////////////////////////////////////////
   function btnAdd_Click(cnt){
	  var id='';
	  for(var i=1;i<=cnt;i++){
	   id='#click'+i;	  
	   $(id).trigger("click"); // 실행하자마자 click 이벤트를 트리거함... 
	 }
  }  
  function goIsbn(b_num){
	 
	   var b_jemok=$('#b_jemok'+b_num).val();
	   var b_name=$('#b_name'+b_num).val();
	  
/* 	   var gals=b_jemok.lastIndexOf("(");
	   var gale=b_jemok.lastIndexOf(")");
	   if(gals!=-1){
		   var front=b_jemok.substring(0,gals);
		   var end=b_jemok.substring(gale+1);
		   b_jemok=front+end;
		   
	   } */
	   var isv=b_name.indexOf(",");
	   if(isv!=-1){
		   //var bnk=b_name.lastIndexOf(" ");
		   b_name=b_name.substring(0,isv);
		   var g=b_name.indexOf("글");
		   if(g!=-1){
			   b_name=b_name.substring(0,g);
		   }
	   }else{
		   var a=b_name.indexOf("편");
		   var b=b_name.indexOf("등저");
		   var c=b_name.indexOf("공저");
		   var d=b_name.indexOf("공역");
		   var e=b_name.indexOf("공편");
		   var f=b_name.indexOf("외");
		   var g=b_name.indexOf("(사)");
		   if(a!=-1 || b!=-1 || c!=-1 || d!=-1 || e!=-1 || f!=-1){
			   var bnk=b_name.lastIndexOf(" ");
			   b_name=b_name.substring(0,bnk);
		   }
		   if(g!=-1){
			   b_name=b_name.substring(3);
		   }
	   }	
	  //alert(b_jemok+":"+b_num);
	  // String uri="http://www.kyobobook.co.kr/search/SearchCommonMain.jsp?vPstrCategory=TOT&vPplace=top&vPstrKeyWord="+sql;
	  var tag='#b_isbn'+b_num;
	  var getVal="vPstrCategory=TOT&vPplace=top&vPstrKeyWord="+b_jemok+" "+b_name;
	  $.ajax({
		    type:"get",
	    	url:"isbn.spr",
	    	data: getVal,
	    	success: function(data){ 
	    		process(data, tag, b_name);
	    		//$(tag).html('aaaa');
	    	},
	    	error: function(data){
	    		//alert(data);
	    	}
	      });	  
  }
  function process(data, tag, b_name){
	  $(tag).empty();
	  var len=$(data).find('#images').length;
	  if(len==0){
		  $(tag).val("X");
		  $(tag).css("color","blue");
	  }
	  if(len==1){
		   var h=$(data).find('#images img').attr("src");
		   var pos=h.lastIndexOf("/m");
		   var end=h.indexOf(".jpg");
		   var isbn=h.substring(pos+2,end);
		      $(tag).val(isbn);
			  $(tag).css("color","blue");
	  }else if(len>1){
		  var au=$(data).find('.author').length;
		  for(var i=0;i<au;i++){
			  var author=$(data).find('.author').eq(i).text();
			   if(author==b_name){
				  var h=$(data).find('#images').eq(i).find('img').attr("src");
				   var pos=h.lastIndexOf("/m");
				   var end=h.indexOf(".jpg");
				   var isbn=h.substring(pos+2,end);
				    $(tag).val(isbn);
				    $(tag).css("color","blue");
				   break;
			  }			  
		  }
		  
	  }
	  //var h=$(data).find('#images img').attr("src");
	  //alert(h);
	 /*  //var num = parseFloat(h, 10)
	   var pos=h.lastIndexOf("/m");
	   var end=h.indexOf(".jpg");
	   var isbn=h.substring(pos+2,end); 
	  //$('#display').text(data);
	 //var h=$('#display').find('img:eq(0)').attr("src");
	  $(tag).html(isbn);
	   */
  }
  function goBatchIsbn(cnt){
	  var id='';
	  for(var i=cnt-9;i<=cnt;i++){
	   id='#click'+i;	  
	   $(id).trigger("click"); // 실행하자마자 click 이벤트를 트리거함... 
	 }
	  $('#b_isbn'+cnt).parent().parent().css("backgroundColor",'silver'); 
  }
  function jemoku(num){
	  tablename=$('#tablename option:selected').text();
	  var snum=$('#sheetName').text();
	  var pos1=snum.indexOf("(");
	  var pos2=snum.indexOf(")");
	  snum=snum.substring(pos1+1,pos2);
	  //alert(sname);
	   var id='';
	  id='#b_jemok'+num;
	  var b_jemok=$(id).val();
	  var getVal="b_jemok="+b_jemok+"&num="+num+"&snum="+snum+"&tablename="+(tablename+snum);
	  $.ajax({
		    type:"get",
	    	url:"update.spr",
	    	data: getVal,
	    	success: function(data){ 
	    		$(id).css("backgroundColor","aqua");
	    	},
	    	error: function(data){
	    		$(id).css("backgroundColor","aqua");
	    	}
	      });	   
  }
  function bname(num){
	  tablename=$('#tablename option:selected').text();
	  var snum=$('#sheetName').text();
	  var pos1=snum.indexOf("(");
	  var pos2=snum.indexOf(")");
	  snum=snum.substring(pos1+1,pos2);
	  var id='';
	  id='#b_name'+num;
	  var b_name=$(id).val();
	  var getVal="b_name="+b_name+"&num="+num+"&snum="+snum+"&tablename="+(tablename+snum);
	  $.ajax({
		    type:"get",
	    	url:"nameupdate.spr",
	    	data: getVal,
	    	success: function(data){ 
	    		$(id).css("backgroundColor","aqua");
	    	},
	    	error: function(data){
	    		$(id).css("backgroundColor","aqua");
	    	}
	      });	  
  }
  function company(num){
	  tablename=$('#tablename option:selected').text();
	  var snum=$('#sheetName').text();
	  var pos1=snum.indexOf("(");
	  var pos2=snum.indexOf(")");
	  snum=snum.substring(pos1+1,pos2);
	  var id='';
	  id='#b_company'+num;
	  var b_company=$(id).val();
	  var getVal="b_company="+b_company+"&num="+num+"&snum="+snum+"&tablename="+(tablename+snum);
	  $.ajax({
		    type:"get",
	    	url:"companyupdate.spr",
	    	data: getVal,
	    	success: function(data){ 
	    		$(id).css("backgroundColor","aqua");
	    	},
	    	error: function(data){
	    		$(id).css("backgroundColor","aqua");
	    	}
	      });	  
  }
  function isbn(num){
	  tablename=$('#tablename option:selected').text();
	  var snum=$('#sheetName').text();
	  var pos1=snum.indexOf("(");
	  var pos2=snum.indexOf(")");
	  snum=snum.substring(pos1+1,pos2);
	  var id='';
	  id='#b_isbn'+num;
	  var b_isbn=$(id).val();
	  var getVal="b_isbn="+b_isbn+"&num="+num+"&snum="+snum+"&tablename="+(tablename+snum);
	  $.ajax({
		    type:"get",
	    	url:"isbnupdate.spr",
	    	data: getVal,
	    	success: function(data){ 
	    		$(id).css("backgroundColor","aqua");
	    	},
	    	error: function(data){
	    		$(id).css("backgroundColor","aqua");
	    	}
	      });	  
  }
  function goDownLoad(){
	  tablename=$('#tablename option:selected').text();
	  document.dfrm.tablename.value=tablename;
	  document.dfrm.submit();
	  //location.href="download.spr?tablename="+tablename; 
  }
</script>
</head>
<body>
<center>
<fieldset style="width: 1000px;">
  <legend>ISBN 검수프로그램(검수할 엑셀파일 UPLOAD)</legend>
<form:form id="multiForm" modelAttribute="uploadCommand" method="post" enctype="multipart/form-data" action="uploadActionVer1.spr">
	<table border="0" cellpadding="0" cellspacing="3">
	<tr>
	  <td>아이디 </td>
	  <td><input type="text" name="title" id='title' value="${uploadCommand.title}"/>
	  <div style="color:red;font-size: 12px;"><form:errors path="title"/></div>
	  </td>    
	  <td>패스워드</td>
	  <td>
	  <input type="password" name="name" id='name' value="${uploadCommand.name}"/>
	  <div style="color:red;font-size: 12px; "><form:errors path="name"/></div>	
	  </td>
	  <td> 파일</td>
	  <td>
	    <input type="file" name="upFile" id='upFile'/>${uploadCommand.upFile.originalFilename}
	    <div style="color:red; font-size: 12px; "><form:errors path="upFile"/></div>	
	  </td>
	  <td align="center">
	  <input id="btnAdd"  type="submit" value="파일업로드"/>	  
	  </td>
	</tr>	
</table>
</form:form>  
</fieldset>

<fieldset style="width: 1000px; text-align: center;" >
  <legend>ISBN 미검수된 EXCEL파일의 각 SHEET출력</legend>
  <table border="0" width="900px" align="center">
   <tr>
   <form:form action="sheetList.spr" id="sheetList">
   <td width="80px" bgcolor="aqua" valign="bottom">업로드된파일</td>
   <td align="center" width="150px" bgcolor="aqua" valign="middle">
           <div id="fileList"></div>
   </td>
   <td align="center" width="120px">
   <div id="sheetdisplay" style="visibility: visible;"> 
	     <input type="submit" value="SHEET불러오기"/>
   </div>	     
   </td>
   </form:form>
   <td align="center"><div id="ctlMemoList" align="center"></div></td>
   <td align="right">
    <div id="deldisplay" style="visibility: visible;">
    <input id='exceldownload' type="button" value="작업완료EXCEl파일다운로드" style="color: red;" onclick="goDownLoad()"/>
    <input id='alldelete' type="button" value="작업완료파일삭제하기" style="color: red;"/></td>
   </div>
   </tr>
   
  </table> 
</fieldset>
<div id="panel" style="visibility:hidden;">
<fieldset style="width: 1000px; text-align: center;" >
  <legend><font color="red"><div id="sheetName" align="center"></div></font></legend>
  <div id="ctlExcelSave" align="right">
     <input id="isbnDBSave" type="button" value="DB저장하기"/>
     <input style="text-align: center;" id="excelSave"  type="submit" value="최종EXCEL파일생성"/>
  </div>
  <div id="ctlExcelList" align="center"></div>
</fieldset>
</div>
</center>
<form action="download.spr" method="post" name='dfrm'>
  <input type="hidden" name="tablename" value=''/>
</body>
</html>